<!DOCTYPE html>
<html lang="en" class="no-js" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorator="layout">
<head>
<title>包邮卡管理</title>
</head>
<body>
<div layout:fragment="content">
	<div class="row">
		<div class="col-md-12">
			<div class="btn-group pull-right">
				<a href="index.html" th:href="@{/promotion/postcard/index/}" id="link_return" class="btn green">返回<i class="fa fa-arrow-circle-o-left"></i></a>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-md-12">
			<div class="form">
				<form role="form" id="form_postcard_edit"  th:action="@{/promotion/postcard/save}" th:object="${postCardPromotion}" method="post" class="form-horizontal">
					<h4 class="form-section">包邮卡类型信息</h4>
					<input id="hidden_id" type="hidden" th:field="*{id}" />
                    <input id="hidden_grantNum" type="hidden" th:field="*{grantNum}"/>
                    <input id="hidden_usedNum" type="hidden" th:field="*{usedNum}" />

					<div class="form-body">
						<div class="form-group" th:class="${#fields.hasErrors('name')}? 'form-group has-error' : 'form-group'">
							<label class="control-label col-md-3">类型名称<span class="required" aria-required="true">* </span></label>
							<div class="col-md-4">
								<input type="text" id="text_name" class="form-control" placeholder="包邮卡类型名称" th:field="*{name}"/>
								<span class="help-block" th:if="${#fields.hasErrors('name')}" th:errors="*{name}">类型名称不能为空</span>
							</div>
						</div>
                        <div class="form-group" th:class="${#fields.hasErrors('monthLimitCount')}? 'form-group has-error' : 'form-group'">
                            <label class="control-label col-md-3">使用时限<span class="required" aria-required="true">*</span></label>
                            <div class="col-md-4">
                                <input type="text" id="text_monthLimitCount" class="form-control" placeholder="使用时限" th:field="*{monthLimitCount}"/>
                                <span class="help-block" th:if="${#fields.hasErrors('monthLimitCount')}" th:errors="*{monthLimitCount}">包邮卡时限必须为数字</span>
                            </div>
                            <div class="col-md-1">
                                <label class="control-label">个月</label>
                            </div>
                        </div>
                        <div class="form-group" th:class="${#fields.hasErrors('timesLimitCount')}? 'form-group has-error' : 'form-group'">
                            <label class="control-label col-md-3">使用次限<span class="required" aria-required="true">*</span></label>
                            <div class="col-md-4">
                                <input type="text" id="text_timesLimitCount" class="form-control" placeholder="使用时限" th:field="*{timesLimitCount}"/>
                                <span class="help-block" th:if="${#fields.hasErrors('timesLimitCount')}" th:errors="*{timesLimitCount}">包邮卡次限必须为数字</span>
                            </div>
                            <div class="col-md-1">
                                <label class="control-label">次</label>
                            </div>
                        </div>
					</div>
					<div class="form-actions fluid">
						<div class="col-md-offset-3 col-md-9">
							<button type="submit" id="bt_submit" name="bt_submit" class="btn blue">提交</button>
							<!-- <button type="reset" id="btn_reset" name="btn_reset" class="btn default">清空</button> -->
						</div>
					</div>
				</form>		
			</div>
		</div>
	</div>
</div>	
</body>
</html>
<script th:inline="javascript">
    /*<![CDATA[*/
    $(document).ready(function(){
        $("#form_postcard_edit").validate({
            rules:{
                name:{
                    required:true,
                    maxlength:250
                },
                monthLimitCount:{
                    required:true,
                    digits:true,
                    max:99999999
                },
                timesLimitCount:{
                    required:true,
                    digits:true,
                    max:99999999
                }
            },
            messages:{
                name:{
                    required:"请输入包邮卡类型名称",
                    maxlength:"最大不能超过250个字符"
                },
                monthLimitCount:{
                    required:"请输入使用时限",
                    digits:"请输入正整数",
                    max:"最大值为99999999"
                },
                timesLimitCount:{
                    required:"请输入使用次限",
                    digits:"请输入正整数",
                    max:"最大值为99999999"
                }
            }
        });
    });
    /*]]>*/
</script>